package com.hurl.waguji.biz;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.apache.log4j.Logger;

import com.hurl.waguji.base.Configuration;
import com.hurl.waguji.biz.schedule.ScheduleService;

/**
 * 应用程序启动类。
 * 该类负责应用程序启动时需执行的操作和任务、注册需要的定时计划等。
 * @author hurl
 *
 */
public class Startup extends HttpServlet {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8741724503385227460L;
	private static Logger log = Logger.getLogger(Startup.class);
	
	@Override
	public void init() throws ServletException {
		super.init();
		if(!Configuration.isDebugMode()){
			ScheduleService.start();
		}
	}

	@Override
	public void destroy() {
		super.destroy();
		if(!Configuration.isDebugMode()){
			ScheduleService.shutdown();
		}
	}
	
}
